package com.jcp.dao;

import java.util.List;

import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import com.jcp.entity.MonthMoney;

/**
 * 统计营收的控制器
 * @author Administrator 吴祥鑫
 *
 */
@Repository
public interface MoneyMapper {
	
 ////查询今天的充值金额
	@Select(value="SELECT sum(payment_amount) from Parment where DATEDIFF(NOW(),payTime)=0 and paymentType=1")
	Integer selectDeposit();
	
	//查询今天的租车位金额
	@Select(value="SELECT sum(payment_amount) from Parment where DATEDIFF(NOW(),payTime)=0 and paymentType=0")
	Integer selectRent();
	//查询今天临时停车得钱
	@Select(value="SELECT sum(payment_amount) from Record where DATEDIFF(NOW(),out_time)=0 and paymentId=0")
	Integer selectTemp();	
	@Select(value="SELECT sum(payment_amount) from Parment")
	Integer getRecordT();
	@Select(value="SELECT sum(payment_amount) from Record")
	Integer getPaymentT();
	
	//查询每月的存款收入
	@Select(value="select year(NOW()) xyear,  \r\n" + 
			"month(payTime) xmonth,  \r\n" + 
			"sum(payment_amount) xtotal  \r\n" + 
			"from Parment  \r\n" + 
			"group by year(NOW()),  \r\n" + 
			"month(payTime)")
	List<MonthMoney> selectMP();
	//查询每月的付费收入
		@Select(value="select year(NOW()) xyear,  \r\n" + 
				"month(out_time) xmonth,  \r\n" + 
				"sum(payment_amount) xtotal  \r\n" + 
				"from Record  \r\n" + 
				"group by year(NOW()),  \r\n" + 
				"month(out_time)")
		List<MonthMoney> selectMR();
	
}
